import { useRef, useCallback } from 'react';
export function useRefCallback<T extends (...args: any[]) => any>(callback: T) {
  const callbackRef = useRef(callback);
  callbackRef.current = callback;

  // 使用 useCallback 来保证每次 render 引用不更新
  return useCallback((...args: any[]) => callbackRef.current(...args), []) as T;
}
